# Set up the terminal and output
set terminal pngcairo size 1200,800 enhanced font 'Verdana,10'
set output 'mini_wasm_architecture.png'

# Set up plot properties
set style fill solid border -1
set key off
set border 0
set grid

# Set up the layout
set xrange [0:1]
set yrange [0:1]
unset xtics
unset ytics

# Define nodes and positions
set label 1 "Mini-WASM 操作系统" at screen 0.5,0.9 center

# Define subnodes
set label 2 "Mini-WASM 内核" at screen 0.2,0.75
set label 3 "WASM 容器" at screen 0.5,0.75
set label 4 "WASM-Native 技术" at screen 0.8,0.75
set label 5 "安全性和隔离" at screen 0.2,0.55
set label 6 "开发和部署" at screen 0.5,0.55
set label 7 "性能优化" at screen 0.8,0.55

# Define internal nodes
set label 8 "进程管理" at screen 0.2,0.7
set label 9 "内存管理" at screen 0.2,0.65
set label 10 "系统调用接口" at screen 0.2,0.6
set label 11 "设备驱动接口" at screen 0.2,0.55

set label 12 "应用执行" at screen 0.5,0.7
set label 13 "资源管理" at screen 0.5,0.65
set label 14 "网络访问" at screen 0.5,0.6
set label 15 "存储管理" at screen 0.5,0.55

set label 16 "直接执行" at screen 0.8,0.7
set label 17 "API 支持" at screen 0.8,0.65
set label 18 "编译支持" at screen 0.8,0.6

set label 19 "沙箱机制" at screen 0.2,0.45
set label 20 "权限控制" at screen 0.2,0.4
set label 21 "审计和日志" at screen 0.2,0.35

set label 22 "SDK 和工具链" at screen 0.5,0.45
set label 23 "文档和示例" at screen 0.5,0.4
set label 24 "容器管理" at screen 0.5,0.35
set label 25 "更新和维护" at screen 0.5,0.3

set label 26 "JIT 编译" at screen 0.8,0.45
set label 27 "内存管理" at screen 0.8,0.4

# Draw connections
set arrow from screen 0.3,0.75 to screen 0.3,0.7 nohead lw 2
set arrow from screen 0.3,0.65 to screen 0.3,0.6 nohead lw 2
set arrow from screen 0.3,0.6 to screen 0.3,0.55 nohead lw 2

set arrow from screen 0.55,0.75 to screen 0.55,0.7 nohead lw 2
set arrow from screen 0.55,0.65 to screen 0.55,0.6 nohead lw 2
set arrow from screen 0.55,0.6 to screen 0.55,0.55 nohead lw 2

set arrow from screen 0.8,0.75 to screen 0.8,0.7 nohead lw 2
set arrow from screen 0.8,0.65 to screen 0.8,0.6 nohead lw 2
set arrow from screen 0.8,0.6 to screen 0.8,0.55 nohead lw 2

set arrow from screen 0.3,0.55 to screen 0.5,0.55 nohead lw 2
set arrow from screen 0.5,0.55 to screen 0.8,0.55 nohead lw 2

set arrow from screen 0.3,0.45 to screen 0.5,0.45 nohead lw 2
set arrow from screen 0.5,0.45 to screen 0.8,0.45 nohead lw 2

# Draw the plot
plot x notitle

